package dongshi.daddy.state;

import dongshi.daddy.state.context.JdLogistics;
import dongshi.daddy.state.state.OrderState;
import dongshi.daddy.state.state.ProductOutState;
import dongshi.daddy.state.state.TransportState;
import org.junit.Test;

public class StateClient {

    @Test
    public void buyKeyboard() {
        //状态的保持与切换者
        JdLogistics jdLogistics = new JdLogistics();

        System.out.println("--------转换为接单状态--------");
        //接单状态
        OrderState orderState = new OrderState();
        jdLogistics.setLogisticsState(orderState);
        jdLogistics.doAction();

        System.out.println("--------转换为出库状态--------");
        //出库状态
        ProductOutState productOutState = new ProductOutState();
        jdLogistics.setLogisticsState(productOutState);
        jdLogistics.doAction();

        System.out.println("--------转换为运输状态--------");
        //运输状态
        TransportState transportState = new TransportState();
        jdLogistics.setLogisticsState(transportState);
        jdLogistics.doAction();
    }
}
